<%--
  Created by IntelliJ IDEA.
  User: 86492
  Date: 2022/4/10
  Time: 10:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
    <meta charset="utf-8">
    <title>班级管理</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        html,body{
            height: 100%;
            width: 100%;
        }
        body{
            display: flex;
        }
        td{
            font-size: 20px;
            padding: 10px 10px 10px 10px;
            text-align: center;
        }
        thead td {
            background-color: #7074c6;
        }
        tbody td{
            background-color: #FAEBD7;
        }
        table{

            border: 1px solid black;
            /* 表格间距 */
            border-spacing: 0px;
        }
        .tableStyle{
            width: 130px;
            height: 100%;
            font-size: 20px;
        }

    </style>
</head>
<body>

<div>
    <table >
        <thead>
        <tr>

            <td>学生姓名</td>
            <td>学生年龄</td>
            <td>学生性别</td>
            <td>学生现在所属班级</td>
            <td>修改到班级</td>
        </tr>
        </thead>
        <form action="studentClassManager" method="get">
            <tbody>
<%--            遍历查询并显示--%>
            <c:if test="${not empty studentClassManager}">
                <c:forEach items="${studentClassManager}" var="stuc">
                    <tr>

                        <td>${stuc.student.name}</td>
                        <td>${stuc.student.age}</td>
                        <td>${stuc.student.sex}</td>
                        <td>${stuc.studentClass == 1 ? "一年一班":stuc.studentClass == 2 ? "一年二班": stuc.studentClass == 3 ?"一年三班" :"未分配班级"}</td>
                        <td>
                            <select class="tableStyle" name=${stuc.student.name}>
                                <c:if test="${empty stuc.studentClass}">
                                    <option value="0" selected>请选择</option>
                                </c:if>

                                <option <c:if test="${fn:contains(stuc.studentClass,'1')}">selected</c:if> value="1">一年一班</option>
                                <option <c:if test="${fn:contains(stuc.studentClass,'2')}">selected</c:if>  value="2">一年二班</option>
                                <option <c:if test="${fn:contains(stuc.studentClass,'3')}">selected</c:if>  value="3">一年三班</option>

                            </select>
                        </td>
                    </tr>

                </c:forEach>

                <tr>
                    <td> </td>
                    <td> </td>
                    <td> </td>
                    <td>
                        <button class="tableStyle">修改完成</button>
                    </td>
                    <td>
                        <button type="reset" class="tableStyle">重置</button>
                    </td>
                </tr>
                </tbody>
            </c:if>
        </form>
    </table>

</div>

</body>
</html>
